-- first.lua

local storyboard = require("storyboard")
local scene = storyboard.newScene()

-- beginning implementation
local widget = require("widget")
local button1, text, button2
--called when the scene's view does not exist:
local group

function scene:createScene(event)
	group = self.view
	group:insert(getBackground())
	
	text = display.newText("Waiting for button event...",  display.contentWidth*.1, display.contentHeight * 0.1, display.contentWidth, display.contentHeight * 0.5, native.systemFont, 32)
	group:insert(text)
	button1 = widget.newButton{
		label = "State's Capital",
		fontSize = 25,
		labelColor = {default={255,255,255,255},over={255,255,255,255}},
		emboss = false,
		defaultColor = {60,79,60,255},
		overColor = {108,142,108,255},
		width = 180,
		height = 30,
		--default = "images/buttonRed.png",
		--over	= "images/buttonRedOver.png",
		strokeColor = {108,142,108,255},
		cornerRadius = 2
	}
	button1.x = display.contentWidth * 0.5; button1.y = display.contentHeight * 0.5
	group:insert(button1)
	
	button2 = widget.newButton{
		label = "Learning Ordinal Number",
		width = 290,
		height = 30,
		defaultColor = {207, 87, 4},
		strokeWidth = 0,
		cornerRadius = 2,
		fontSize = 25,
		overColor = {219, 144 , 56},
		labelColor = {default ={96, 17, 25}, over={  96, 17, 25 }}
	}
	button2.x = display.contentWidth * 0.5; button2.y = display.contentHeight * 0.6
	group:insert(button2)
	
end

--called immediately after scene has moved onscreen:
function scene:enterScene(event)

	
	storyboard.purgeScene( "second" )
	-- button handlers
	local button1Press = function(event)
		text:setText("I AM PRESSED")
		storyboard.gotoScene( "stategame", "crossFade", 400  )
	end
	
	local button2Press = function(event)
		storyboard.gotoScene( "game", "crossFade", 400 )
	end
	
	button1:addEventListener("tap", button1Press)
	button2:addEventListener("tap", button2Press)
end

--called when scene is about to move offscreen:
function scene:exitScene(event)
end

--called prior to the removal of scene's "view" (display group)
function scene:destroyScene(event)
end

--end implementation

scene:addEventListener("createScene", scene)
scene:addEventListener("enterScene", scene)
scene:addEventListener("destroyScene", scene)

return scene